################################################################################
## MOD Title:		easyUCP update 1.1.6 to 1.2.0
## MOD Author:		AmigaLink < webmaster@amigalink.de > (Markus Schmidt) http://www.EssenMitFreude.info
## 
## Installation Level:	Difficult
## Installation Time:	5- 10 Minutes 
##
## Files To Edit:  	5
##			includes/usercp_register.php
##			includes/usercp_viewprofile.php
##
##			templates/subSilver/easyucp_body.tpl
##
##			language/lang_english/lang_main.php
##			language/lang_german/lang_main.php
##
## Included Files:	0
##
################################################################################
## The following sites also contain the latest version of this MOD: 
## 
## http://www.AmigaLink.de
## http://www.phpBBhacks.com
## http://www.phpBB.de
## 
## Full support for this MOD only can be obtained at: 
##
## http://www.AmigaLink.de
##  
################################################################################
## MOD History: 
## 
##   2005-07-25 - Version 1.2.0
##	- a security change
##	- last visit added
##	- last post added
##	- display usergroups added
##	- preperation to future extensions
##
##   2005-02-18 - Version 1.1.6 (unreleased)
##	- some bugfixes
##	- some little optical changes
##	- work with phpBB 2.0.11 and above
##
##   2004-09-11 - Version 1.1.1 plus
##	- phpBB plus 1.5x installation guide
##
##   2004-08-31 - Version 1.1.1
##	- Fixed a little bug in the lang_main.php part of the installation guide
##
##   2004-08-29 - Version 1.1.0
##	- First release
##	- User selectable Guests-Profileview-permission added
##
##   2004-08-28 - Version 1.0.3 rc
##	- one little bugfix by OXPUS
##	- one little stylefix by OXPUS
##
##   2004-08-25 - Version 1.0.0
##	- First Version
## 
################################################################################
##
##  This hack is released under the GPL License. 
##  This hack can be freely used, but not distributed, without permission.
##  Intellectual Property Rights are retained by the hack author(s) 
##  listed above.
##
################################################################################
##
##  BEFORE ADDING THIS HACK TO YOUR FORUM, please be sure to backup ALL
##  affected files.
##
################################################################################

#
#----------[ OPEN ]-------------------------------------
#

includes/usercp_viewprofile.php

#
#----------[ FIND ]-------------------------------------
#

	    $template->assign_block_vars('switch_user_sig_block', array());
    }
}

#
#----------[ AFTER, ADD ]-------------------------------
#

$usergroups = '';
$groups = array();
$sql = 'SELECT g.group_id, g.group_name, g.group_description, g.group_type 
	FROM '.USER_GROUP_TABLE.' as l, '.GROUPS_TABLE.' as g 
	WHERE l.user_pending = 0 AND g.group_single_user = 0 AND l.user_id =' . $profiledata['user_id'] . ' AND g.group_id = l.group_id 
	ORDER BY g.group_name, g.group_id';

if ( !($result = $db->sql_query($sql)) ) message_die(GENERAL_ERROR, 'Could not read groups', '', __LINE__, __FILE__, $sql);	
while ($group = $db->sql_fetchrow($result)) $groups[] = $group;

if (count($groups) > 0)
{
	$template->assign_block_vars("switch_usergroups", array());

	for ($i=0; $i < count($groups); $i++)
	{
		( (($groups[$i]['group_type'] != GROUP_HIDDEN) || ($userdata['user_level'] == ADMIN)) ? $is_ok = true : $is_ok = false );
		if (!$is_ok)
		{
			$group_id = $groups[$i]['group_id'];
			$sql = 'SELECT *
				FROM '.USER_GROUP_TABLE.'
				WHERE group_id=' . $group_id . ' AND user_id=' . $userdata['user_id'] . ' AND user_pending=0';

			if ( !($result = $db->sql_query($sql)) ) message_die(GENERAL_ERROR, 'Couldn\'t obtain viewer group list', '', __LINE__, __FILE__, $sql);
			$is_ok = ( $group = $db->sql_fetchrow($result) );
		}

		( $is_ok ? $usergroups .= '<a href = "' . append_sid("groupcp.php?g=".$groups[$i]['group_id']) . '" alt = "' . $groups[$i]['group_description'] . '" title = "' . $groups[$i]['group_description'] . '">' . $groups[$i]['group_name'] . '</a>' : '');

		( $i < (count($groups) -1) ? $usergroups .= ', ' : '');
	}
}

$sql = "SELECT post_time
	FROM " . POSTS_TABLE . "
	WHERE poster_id = " . $profiledata['user_id'] . "
	ORDER BY post_time DESC
	LIMIT 1";

if ( !($result = $db->sql_query($sql)) ) message_die(GENERAL_ERROR, 'Error getting user last post time', '', __LINE__, __FILE__, $sql);

$last_post_row = $db->sql_fetchrow($result);
$last_post_time = ( isset($last_post_row['post_time']) ) ? create_date($board_config['default_dateformat'], $last_post_row['post_time'], $board_config['board_timezone'] ) : $lang['no_post'];
( isset($last_post_row['post_time']) ) ? $template->assign_block_vars('switch_postings', array()) : '';

$last_visit_time = ($profiledata['user_session_time']) ? create_date($lang['DATE_FORMAT'], $profiledata['user_session_time'], $board_config['board_timezone']) : $lang['never_visited'];

#
#----------[ FIND ]-------------------------------------
#

	if($userdata['user_id'] == $profiledata['user_id'] )

#
#----------[ REPLACE WITH ]-----------------------------
#

	if($userdata['user_id'] === $profiledata['user_id'] )

#
#----------[ FIND ]-------------------------------------
#

	'EASY_UCP' => $lang['easyUCP'],

#
#----------[ AFTER, ADD ]-------------------------------
#

	'LAST_VISIT' => $last_visit_time,
	'LAST_POST_TIME' => $last_post_time,
	'PROFIL_CONTROL' => $lang['easyUCP_profil_control'],
	'EXTENSION_CONTROL' => $lang['easyUCP_extension_control'],

#
#----------[ FIND ]-------------------------------------
#

	'USER_SIG' => $user_sig,

#
#----------[ BEFORE, ADD ]------------------------------
#

	'USERGROUPS' => $usergroups,

#
#----------[ FIND ]-------------------------------------
#

	'L_USER' => $profiledata['username'],

#
#----------[ AFTER, ADD ]-------------------------------
#

	'L_USERGROUPS' => $lang['Usergroups'],
	'L_LAST_VISIT' => $lang['last_visit'],
	'L_LAST_POST' => $lang['Last_Post'],

#
#----------[ OPEN ]-------------------------------------
#

templates/subSilver/easyucp_body.tpl

#
#----------[ FIND ]-------------------------------------
#

							<tr>
							<td valign="top" align="right" nowrap="nowrap"><span class="gen">{L_TOTAL_POSTS}:&nbsp;</span></td>

#
#----------[ BEFORE, ADD ]------------------------------
#

							<!-- BEGIN switch_postings -->

#
#----------[ FIND ]-------------------------------------
#

							<td valign="top"><b><span class="gen">{POSTS}</span></b><br /><span class="genmed">[{POST_PERCENT_STATS} / {POST_DAY_STATS}]</span> <br /><span class="genmed"><a href="{U_SEARCH_USER}" class="genmed">{L_SEARCH_USER_POSTS}</a></span></td>
							</tr>

#
#----------[ AFTER, ADD ]-------------------------------
#

							<!-- END switch_postings -->
							<tr>
							<td width="30%" valign="top" align="right"><span class="gen">{L_LAST_POST}:&nbsp;</span></td>
							<td valign="top" width="100%"><b><span class="gen">{LAST_POST_TIME}</span></b></td>
							</tr>
							<!-- BEGIN switch_usergroups -->
							<tr>
							<td valign="top" align="right" nowrap="nowrap"><span class="gen">{L_USERGROUPS}:&nbsp;</span></td>
							<td valign="top" width="100%"><b><span class="gen">{USERGROUPS}</span></b></td>
							</tr>
							<!-- END switch_usergroups -->

#
#----------[ FIND ]-------------------------------------
#

			</td><td rowspan="2" valign="top" height="100%" width="20%">

#
#----------[ AFTER, ADD ]-------------------------------
#

			<table width="100%" cellspacing="0" cellpadding="0" border="0">
			<tr><td>

#
#----------[ FIND ]-------------------------------------
#

					<td class="catLeft" height="28" align="center"><b><span class="gen">&nbsp;{L_PREFERENCES}&nbsp;</span></b></td>

#
#----------[ REPLACE WITH ]-----------------------------
#

					<td class="catLeft" height="28" align="center"><b><span class="gen">&nbsp;{PROFIL_CONTROL}&nbsp;</span></b></td>

#
#----------[ FIND ]-------------------------------------
#

					&nbsp;</td>
						<!-- END switch_signature_button -->

#
#----------[ REPLACE WITH ]-----------------------------
#

					</td>
						<!-- END switch_signature_button -->

#
#----------[ FIND ]-------------------------------------
#

			<!-- END switch_own_profile -->

#
#----------[ BEFORE, ADD ]------------------------------
#

			<!-- BEGIN preperation -->
			</td></tr><tr><td height="6"></td></tr><tr><td>
				<table class="forumline" width="100%" cellspacing="1" cellpadding="3" border="0" align="right">
					<tr>
					<td class="catLeft" height="28" align="center"><b><span class="gen">&nbsp;{EXTENSION_CONTROL}&nbsp;</span></b></td>
					</tr>
					<tr>
					<td class="row3" height="100%" align="center"><br />
					&nbsp;</td>
					</tr>
				</table>
			<!-- END preperation -->
			</td></tr></table>

#
#----------[ FIND ]-------------------------------------
#

<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
	<td align="right"><span class="nav"><br />{JUMPBOX}</span></td>
  </tr>
</table></form>

#
#----------[ REPLACE WITH ]-----------------------------
#

</form>

#
#----------[ OPEN ]-------------------------------------
#

language/lang_english/lang_main.php

#
#----------[ FIND ]-------------------------------------
#

$lang['easyUCP'] = '<font color="red">easy</font> User Control Panel';

#
#----------[ AFTER, ADD ]-------------------------------
#

$lang['easyUCP_profil_control'] = 'Profil preferences';
$lang['easyUCP_extension_control'] = 'Control panel';

#
#----------[ FIND ]-------------------------------------
#

$lang['Hide_profile'] = 'Allow Profileview for Guests';

#
#----------[ AFTER, ADD ]-------------------------------
#

$lang['last_visit'] = 'Last visit';
$lang['never_visited'] = 'Never loged in!';
$lang['no_post'] = 'no postings';

#
#----------[ OPEN ]-------------------------------------
#

language/lang_german/

#
#----------[ FIND ]-------------------------------------
#

$lang['easyUCP'] = '<font color="red">easy</font> User Control Panel';

#
#----------[ AFTER, ADD ]-------------------------------
#

$lang['easyUCP_profil_control'] = 'Profileinstellungen';
$lang['easyUCP_extension_control'] = 'Kontrollzentrum';

#
#----------[ FIND ]-------------------------------------
#

$lang['Hide_profile'] = 'Profilansicht fr Gste erlauben';

#
#----------[ AFTER, ADD ]-------------------------------
#

$lang['last_visit'] = 'Letzter Besuch';
$lang['never_visited'] = 'Noch nie eingelogt!';
$lang['no_post'] = 'keine Beitrge';

#
#----------[ SAVE AND CLOSE ALL FILES ]-----------------
#
# EoM
